home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / cislib_a / c2tosd.lis < prev    next >
File List  |  1995-04-22  |  5KB  |  168 lines

  1. 1000 Rem DIMENSION AND INITIALIZE VARIABLES
  2. 1010 Dim Dirbuf$(8*128):Let Dirbuf$(8*128)="*"
  3. 1020 Dim First(1),Last(1)
  4. 1030 Dim Q$(1)
  5. 1040 Dim Secbuf$(300)
  6. 1050 Dim Copytodir$(100),Copyto$(120)
  7. 1060 Rem 
  8. 1070 Rem MESSAGES AND ANSWERS
  9. 1080 Rem 
  10. 1090 Put #0,125
  11. 1100 Print "Copy files from DOS 2.x disk to"
  12. 1110 Print "   virtually any other DOS"
  13. 1120 Print "      (including SpartaDOS)"
  14. 1130 ? :? 
  15. 1140 Print "First, where are the DOS 2.x files...":? 
  16. 1150 Trap 1150
  17. 1160 Input "What drive number? ",Drvnum
  18. 1170 Trap 0
  19. 1180 ? :? :? 
  20. 1190 Print "Then, where should we copy them to..."
  21. 1200 Print "   Give drive AND directory name as"
  22. 1210 Print "   needed (e.g., D2: or D3:>MYDIR>)."
  23. 1220 Print 
  24. 1230 Print "   [Trailing ':' or '>' IS needed!]"
  25. 1240 ? :Input "Where to? ",Copytodir$
  26. 1250 If Len(Copytodir$)<3 Then Oops=1:Goto 1300
  27. 1260 Q$=Copytodir$(Len(Copytodir$))
  28. 1270 Oops=0
  29. 1280 If Q$<>":" And Q$<>">" And Q$<>"\" Then Oops=1
  30. 1290 If Copytodir$(1,1)<>"D" Or Copytodir$(3,3)<>":" Then Oops=1
  31. 1300 Trap 0
  32. 1310   If Oops:? :? 
  33. 1320   Print "Sorry, something is wrong with the "
  34. 1330   Print "   name of your 'Where to' directory."
  35. 1340   End 
  36. 1350   Endif 
  37. 1360 Rem .........
  38. 1370   If Val(Copytodir$(2))=Drvnum:Rem OOPS!
  39. 1380   ? :? :Print "Sorry, this program is not set up for"
  40. 1390   Print "   single drive transfers!"
  41. 1400   End 
  42. 1410   Endif 
  43. 1420 Rem 
  44. 1430 Rem READ THE DIRECTORY OF DOS 2.X DISK
  45. 1440 Rem 
  46. 1450   For Sector=0 To 7
  47. 1460   Secnum=$0169+Sector
  48. 1470   Secbuf=Adr(Dirbuf$)+128*Sector
  49. 1480   Gosub 2480
  50. 1490   Next Sector
  51. 1500 Rem FIND LAST FILE IN DIRECTORY
  52. 1510 Rem 
  53. 1520 Maxf=63
  54. 1530   For Fnum=0 To 63
  55. 1540   Flag=Peek(Adr(Dirbuf$)+Fnum*16)
  56. 1550   If Flag=0 Then Maxf=Fnum-1:Fnum=99
  57. 1560   Next Fnum
  58. 1570 If Maxf<0 Then Print "NO FILES ON THIS DISK!":End 
  59. 1580 Rem 
  60. 1590 Rem SET UP LIMITS FOR DISPLAY
  61. 1600 First(0)=0:Last(0)=39
  62. 1610 First(1)=-1
  63. 1620   If Maxf>Last(0):Last(0)=31
  64. 1630   First(1)=32:Last(1)=Maxf
  65. 1640   Else :Last(0)=Maxf
  66. 1650   Endif 
  67. 1660 Rem 
  68. 1670 Rem ............................
  69. 1680 Rem 
  70. 1690 Rem (MAIN LOOP)
  71. 1700 Rem 
  72. 1710 Half=1:Rem CURRENT SET OF FILES
  73. 1720 Rem (NEXT LINE IS ENTRY FOR OTHER HALF OF FILES)
  74. 1730 Rem 
  75. 1740 Rem ASK WHICH FILE #
  76. 1750 Rem 
  77. 1760 Half=1-Half
  78. 1770 First=First(Half):Last=Last(Half)
  79. 1780 If First<0 Then 1730
  80. 1790 Gosub 2360
  81. 1800 Print :Print 
  82. 1810 Trap 1730
  83. 1820 Input "Number (RETURN for more files)? ",Fnum
  84. 1830 Trap 0
  85. 1840 Rem 
  86. 1850 Rem USER GAVE US A FILE NUMBER...CHECK IT OUT
  87. 1860 Rem 
  88. 1870 If Fnum<0 Or Fnum>Maxf Or Fnum<>Int(Fnum) Then 1710
  89. 1880 Gosub 2170:Rem GET NAME$?
  90. 1890 If Flag=0 Then Goto 1710:Rem OOPS...INVALID FILE NUMBER!
  91. 1900 Rem VALID FILE
  92. 1910 Put #0,125
  93. 1920 Copyto$=Copytodir$,Name$
  94. 1930 Print "Ready to copy:":? 
  95. 1940 Print "[FROM] D";Chr$(48+Drvnum);":";Name$
  96. 1950 Print "[  TO] ";Copyto$
  97. 1960 ? :Input "Answer Y or N:  Okay? ",Q$
  98. 1970 If Q$<>"Y" And Q$<>"y" Then 1710
  99. 1980 Rem 
  100. 1990 Rem DO THE ACTUAL COPYING
  101. 2000 Rem 
  102. 2010 Close #3:Open #3,8,0,Copyto$
  103. 2020 Secnum=Dpeek(Adr(File$)+3)
  104. 2030 Rem COPY LOOP
  105. 2040   While Secnum
  106. 2050   Print "Sector ";Secnum:Put #0,28
  107. 2060   Secbuf=Adr(Secbuf$)
  108. 2070   Gosub 2480:Rem GET THE SECTOR
  109. 2080   Check=Peek(Secbuf+125)&$fc
  110. 2090   If Check<>Fnum*4 Then ? "FILE LINK ERROR!":End 
  111. 2100   If Peek(Secbuf+127) Then Bput #3,Secbuf,Peek(Secbuf+127)
  112. 2110   Secnum=256*(Peek(Secbuf+125)&3)+Peek(Secbuf+126)
  113. 2120   Endwhile 
  114. 2130 Close #3
  115. 2140 ? :? :Input "COPY DONE...HIT RETURN",Q$
  116. 2150 Goto 1710
  117. 2160 End 
  118. 2170 Rem 
  119. 2180 Rem BUILD FILE NAME, CHECK ITS FLAGS
  120. 2190 Rem 
  121. 2200 Rem ENTER:  FNUM HAS FILE NUMBER
  122. 2210 Rem 
  123. 2220 Rem EXIT:   NAME$ HAS FILE IF VALID
  124. 2230 Rem .       FLAG=0 IF NAME$ INVALID
  125. 2240 Rem .       FILE$ HAS RAW FILE INFO
  126. 2250 Rem 
  127. 2260 Name$=""
  128. 2270 File$=Dirbuf$(Fnum*16+1,Fnum*16+16)
  129. 2280 Flag=Asc(File$)
  130. 2290 If (Flag&$80)<>0 Then Flag=0
  131. 2300   If Flag:Rem (IF GOOD FILE)
  132. 2310   Name$=File$(6,16)," "
  133. 2320   Dot=Find(Name$," ",0):If Dot>8 Then Dot=9
  134. 2330   Name$(Dot)=".",File$(14,16)
  135. 2340   Endif 
  136. 2350 Return 
  137. 2360 Rem SHOW UP TO 32 FILES
  138. 2370 Rem 
  139. 2380 Rem ENTRY:  FIRST IS FIRST FILE TO DISPLAY
  140. 2390 Rem .       LAST  IS LAST ONE TO DISPLAY
  141. 2400 Rem 
  142. 2410 Put #0,125
  143. 2420   For Fnum=First To Last
  144. 2430   Gosub 2170:Rem GET NAME$ SET UP
  145. 2440   If Flag Then Print  Using "## !!!!!!!!!!!!    ",Fnum,Name$,
  146. 2450   If Peek(85)>30 Then Print 
  147. 2460   Next Fnum
  148. 2470 Return 
  149. 2480 Rem 
  150. 2490 Rem READ A SECTOR VIA SIO
  151. 2500 Rem 
  152. 2510 Rem ENTER:  SECNUM HAS SECTOR NUMBER
  153. 2520 Rem .       SECBUF HAS BUFFER ADDRESS
  154. 2530 Rem .       DRVNUM HAS DRIVE NUMBER
  155. 2540 Rem 
  156. 2550 Poke $0300,$31
  157. 2560 Poke $0301,Drvnum
  158. 2570 Poke $0302,Asc("R")
  159. 2580 Poke $0303,$40
  160. 2590 Dpoke $0304,Secbuf
  161. 2600 Dpoke $0306,3
  162. 2610 Dpoke $0308,128
  163. 2620 Dpoke $030a,Secnum
  164. 2630 Set 8,0:Rem TELLS BXL _NOT_ TO PUSH COUNT OF PARAMETERS!
  165. 2640 Junk=Usr($e459):Rem CALL SIO
  166. 2650 If Peek($0303)>1 Then Print "SIO ERROR #";Peek($0303):End 
  167. 2660 Return 
  168. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""